const Koa = require('koa');
const Router = require('koa-router');
const mockList = require('./mock/index');

const app = new Koa();
const router = new Router();

/**
 * 注册mock路由
 */
mockList.forEach(item => {
	const {url, method, response} = item;
	router[method](url, async ctx => {
		ctx.body = response();
	});
});

app.use(router.routes());
// 暴露的端口
app.listen(3001);